#! /usr/bin/env python
#-*- coding: utf-8 -*-

import socket
import time
import struct


def ip2hex(ip):
    return hex(struct.unpack("!I", socket.inet_aton(ip))[0])


def ip2long(ip):
    return struct.unpack("!I", socket.inet_aton(ip))[0]    


def long2ip(lint):
    return socket.inet_ntoa(struct.pack("!I", lint))


# ipaddr

import ipaddr

# ...
